/*********************************************************************************
 *      Copyright:  (C) 2022 South-Central Minzu University
 *                  All rights reserved.
 *
 *       Filename:  gettime.c
 *    Description:  This file :Gets the local time and returns the unformatted time
 *                 
 *        Version:  1.0.0(11/04/22)
 *         Author:  zhangkang <2980640573@qq.com>
 *      ChangeLog:  1, Release initial version on "11/04/22 18:11:05"
 *                 
 ********************************************************************************/
#include <time.h>
#include <stdio.h>
#include <string.h>
#include <sys/time.h>


long get_time(char *datime,int datatim_len)       
{
	  long                    time;
    struct timeval           tv;
    struct tm*              st;
     
    gettimeofday(&tv, NULL);
	  time = tv.tv_sec;
	  st = localtime(&tv.tv_sec);
    memset(datime, 0, sizeof(datime));
	  snprintf(datime, 100,"%04d-%02d-%02d--%02d:%02d:%02d", st->tm_year+1900, st->tm_mon+1, st->tm_mday, st->tm_hour, st->tm_min, st->tm_sec);
	  return time;
}